<?php
declare (strict_types = 1);

namespace app\api\controller;

use app\BaseController;
use app\common\lib\Show;
use think\facade\Request;

class Logout extends BaseController
{
    /**
     * 退出登录
     *
     * @return \think\Response
     */
    public function index()
    {
        $token = Request::header('access-token');
        $res   = cache(config('redis.token.prefix').$token, null);
        if ($res) {
            return Show::success([], '退出成功');
        }
        return Show::error('退出失败');
    }
}
